package operation;

import book.Book;

import java.util.Comparator;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: a
 * Date: 2022-04-15
 * Time: 9:58
 */
public class PriceComparator implements Comparator<Book> {
    @Override
    public int compare(Book o1, Book o2) {
        if((o1.getPrice()-o2.getPrice())>0){
            return 1;
        }else if((o1.getPrice()-o2.getPrice())==0){
            return 0;
        }else{
            return -1;
        }
    }
}
